package com.sunwayworld.basemodule.samplemanage.sample.resource;

import com.alibaba.fastjson.JSONObject;
import com.sunwayworld.basemodule.samplemanage.sample.bean.BatchSampleStaticsDTO;
import com.sunwayworld.basemodule.samplemanage.sample.bean.LimsSampleBean;
import com.sunwayworld.basemodule.samplemanage.sample.service.LimsSampleService;
import com.sunwayworld.framework.data.page.Page;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.restful.data.RestValidationResultBean;
import com.sunwayworld.framework.support.base.resource.GenericResource;
import com.sunwayworld.framework.support.tree.resource.GenericTreeResource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;

@RequestMapping("/secure/baseline/samplemanage/samples")
public interface LimsSampleResource extends GenericResource<LimsSampleService, LimsSampleBean, Long>
        , GenericTreeResource<LimsSampleService, LimsSampleBean, Long> {

    @RequestMapping(value = "/queries/rows")
    Page<LimsSampleBean> selectByParams(RestJsonWrapperBean wrapper);

    @RequestMapping(value = "/print",method = RequestMethod.POST)
    Long printSampleTag(RestJsonWrapperBean wrapper);

    @RequestMapping(value = "/queries/sampleHandles")
    Page<LimsSampleBean> selectSampleHandlesPagination(RestJsonWrapperBean wrapper);

    @PostMapping(value = "/back")
    void back(RestJsonWrapperBean wrapperBean);

    @PostMapping(value = "/destroy")
    void destroy(RestJsonWrapperBean wrapperBean);

    @PostMapping(value = "/search/handle/{handleId}")
    Page<LimsSampleBean> selectHandleSample(@PathVariable Long handleId, RestJsonWrapperBean wrapper);

    @RequestMapping(value = "/scancodecheck",method = RequestMethod.POST)
    Long scanCodeCheck(RestJsonWrapperBean wrapper);

    @PostMapping(value = "/queries/expired")
    Page<LimsSampleBean> selectExpiredSamples(RestJsonWrapperBean wrapperBean);

    @PostMapping(value = "/sample/confirm-expired")
    JSONObject confirmSampleExpired(RestJsonWrapperBean jsonWrapperBean);

    @PostMapping(value = "/edit-sample-multi")
    JSONObject editSampleMulti(RestJsonWrapperBean jsonWrapperBean);

    @RequestMapping(value = "/select/sample/{id}")
    LimsSampleBean selectSampleById(@PathVariable("id") Long id);

    @RequestMapping(value = "/select/formula", method = RequestMethod.POST)
    Page<LimsSampleBean> selectForFormula(RestJsonWrapperBean wrapperBean);

    @RequestMapping(value = "/receive/submit", method = RequestMethod.POST)
    void receiveSubmit(RestJsonWrapperBean wrapperBean);

    @RequestMapping(value = "/abnormal/submit", method = RequestMethod.POST)
    void abnormalSubmit(RestJsonWrapperBean wrapperBean);

    @RequestMapping(value = "/abnormal/confirm", method = RequestMethod.POST)
    void abnormalConfirm(RestJsonWrapperBean wrapperBean);

    @PostMapping(value = "/upload-attachment-multi")
    JSONObject uploadAttachmentMulti(RestJsonWrapperBean jsonWrapperBean);

    @PostMapping(value = "/get-courierdata")
    JSONObject getCourierData(RestJsonWrapperBean jsonWrapperBean);

    @PostMapping(value = "/selectBatchSampleStatics/{year}/count")
    List<BatchSampleStaticsDTO> selectBatchSampleStaticsPage(@PathVariable String year);

    @RequestMapping(value = "/sample/order-task", method = RequestMethod.POST)
    Page<LimsSampleBean> selectTestMethodBySampleCode(RestJsonWrapperBean wrapper);

    @PostMapping(value = "/queries/batch-choose/sample")
    Page<LimsSampleBean> selectBatchChooseSamplePagination(RestJsonWrapperBean wrapper);

    @PostMapping(value = "/print-wh")
    Long print(RestJsonWrapperBean jsonWrapperBean);

    @Log(value = "验证样本编号已经被生成且未被占用", type = LogType.VALIDATE)
    @PostMapping(value = {"/{id}/action/validate-generated-samplecode/{columnName}/{columnValue}", "/action/validate-generated-samplecode/{columnName}/{columnValue}"})
    RestValidationResultBean validateGeneratedSamplecode(@PathVariable(required = false) Long id, @PathVariable(required = false) String columnName, @PathVariable(required = false) String columnValue);

    @PostMapping("/selectPassRate")
    Page<LimsSampleBean> selectPassRate(RestJsonWrapperBean wrapper);
}
